#ifndef _IS_HOMOGRAPHY_K_H
#define _IS_HOMOGRAPHY_K_H

#include "is_quaternion_K.h"
#include "is_homography_matrix_K.h"

#include <iostream>

class IsHomographyK : public IsQuaternionK
{
public:

    kalmanType IS_S;
    kalmanType IS_Theta;
    kalmanType IS_T[2];
    kalmanType IS_SThetaTArray[4];   
    kalmanType IS_HomographyMat[K_MATRIX_LENGTH];
    
    IsHomographyK();
    
    /* 
    * It will calculate the Homography matrix.
    * ABOUT : This function takes the low pass filtered quaternions and return an             homography matrices.
    * Let q_klf[n] is kalman corrected quaternion and q_lpf[n] is low pass filtered
      quaternion. At instant n, quaternion representing the jerk is calculated as
            q_j[n] = q_lpf[n]*inv(q_klf[n])
 
      Then homography is calculated as,
      H[n] = cameraMat[n]*inv(R[n])*inv(cameraMat[n]), where
      cameraMat is the current camera matrix.
      R is the rotation matrix obtained from q_j[n].
    */
    void getHomographyMat(kalmanType* pLpfQuaternion, kalmanType* pKcQuaternion, kalmanType* pCamInternalMatrix); 

    /*
    * This function Decompose this homography matrix into s, theta and T.
    */
    void decomposeHomographyMat(kalmanType *pHomographyMat);

public:
    virtual ~IsHomographyK(void);


};

#endif
